﻿@model MongoServices.Example.Models.ViewModels.BlogIndexViewModel

@{
	ViewBag.Title = "MongoServices Blog";
}

<h2>MongoServices Blog</h2>

<div class="blog-posts">
	<div class="post-action">
		@Html.ActionLink("Create New Post", "Create")
		<br />
		<br />
		@Html.ActionLink("Generate 20 Sample Posts", "GenerateSamples")
	</div>

	<br />

	@foreach (var post in Model.Items.OrderByDescending(m => m.DatePosted)) { 
		<div class="post">
			<div class="post-title post-action">
				@Html.ActionLink(Html.DisplayFor(p => post.Title).ToString(), "Post", new { id = post.Id })
			</div>
			<div class="post-date-posted">
				Date Posted: @Html.DisplayFor(p => post.DatePosted)
			</div>
			<div class="post-actions post-action">
				@Html.ActionLink("Edit Post", "Edit", new { id = post.Id })
				 | 
				@Html.ActionLink("Delete Post", "Delete", new { id = post.Id }) 
			</div>
			<div class="clear"></div>
			<div class="post-body">
				@Html.DisplayFor(p => post.BodyShort)
			</div>
			<div class="post-read-more post-action">
				@Html.ActionLink("Read More...", "Post", new { id = post.Id })
			</div>
			<div class="clear"></div>
		</div>
	}
</div>
